package com.csii.activiti.server.core.entity.db;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableName;
import com.csii.activiti.server.core.entity.ActFlowFormContentSetting;
import com.csii.activiti.server.core.entity.ActFlowNode;
import com.csii.activiti.server.core.entity.BaseIdAndJsonData;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;


/**
 * @author zhoujunchen
 * 流程节点
 */
@TableName("act_e_flow_node")
@Data
public class ActFlowNodeEntity extends BaseIdAndJsonData {
    private String nodeName;
    private String nodeType;
    private String flowKey;
    public ActFlowNode transitionActFlowNode(){
        return JSONObject.parseObject(getJsonData(), ActFlowNode.class);
    }

    public List<ActFlowFormContentSetting> transitionActFlowFormContentSettingList(){
        if (getJsonData() == null || "null".equals(getJsonData())){
            return new ArrayList<>();
        }
        return JSONObject.parseArray(getJsonData(), ActFlowFormContentSetting.class);
    }
}
